﻿using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace nMongo
{
    public static class MongoDatabaseExtensions
    {
        public static MongoCollection<T> GetCollectionFromType<T>(this MongoDB.Driver.MongoDatabase db)
            where T : class
        {
            return db.GetCollection<T>(Helpers.MongoCollectionHelper.GetCollectionNameFromType<T>());
        }
        public static MongoCollection GetCollectionFromType(this MongoDB.Driver.MongoDatabase db, Type type)
        {
            return db.GetCollection(Helpers.MongoCollectionHelper.GetCollectionNameFromType(type));
        }
    }
}

namespace MongoDB.Driver
{
    public static class MongoDatabaseExtensions
    {
        public static MongoCollection<T> GetCollectionFromType<T>(this MongoDB.Driver.MongoDatabase db)
            where T : class
        {
            return nMongo.MongoDatabaseExtensions.GetCollectionFromType<T>(db);
        }
        public static MongoCollection GetCollectionFromType(this MongoDB.Driver.MongoDatabase db, Type type)
        {
            return nMongo.MongoDatabaseExtensions.GetCollectionFromType(db, type);
        }
    }
}